import { Message } from 'element-ui'



export default {
    state: {

        storageBreakpointsId: [], //断点的集合
    },
    getters: {

    },
    mutations: {

        // 存储断点
        storageBreakpoints(state, e) {
            var obj = e
            var index = state.storageBreakpointsId.findIndex((v) => {
                return e.id == v.id
            })
            if (index == -1) {
                state.storageBreakpointsId.push(obj)
            } else {
                Message({
                    type: "warning",
                    message: "此节点已经在断点集合",
                });
                state.storageBreakpointsId.splice(index, 1);
                state.storageBreakpointsId.push(obj)
            }
            // console.log('断点的集合', state.storageBreakpointsId);
        },
        // 删除断点
        deleteBreakpoints(state, e) {
            var index = state.storageBreakpointsId.findIndex((v) => {
                return e.id == v.id
            })
            state.storageBreakpointsId.splice(index, 1);
            // console.log('断点的集合', state.storageBreakpointsId);
        }
    }
}